//
// Created by Jisam on 2024/8/13 23:01.
// solve b
#include <bits/stdc++.h>

#define endl "\n"
#define PSI pair<string,int>
#define PII pair<int,int>
#define PDI pair<double,int>
#define PDD pair<double,double>
#define VVI vector<vector<int>>
#define VI vector<int>
#define VS vector<string>

#define PQLI priority_queue<int, vector<int>, less<int>>
#define PQGI priority_queue<int, vector<int>, greater<int>>
#define u32 unsigned
#define i64 long long
#define u64 unsigned long long

using namespace std;

void solve() {
    int  n ;
    cin >> n; // 输入数组的大小
    vector<int> a(n + 4,0),b(n + 4,-1);

    for(int i = 0 ; i < n ; i ++){
        cin >> a[i];
    }
    if(n <= 2) {
        cout << "YES" <<endl;
        return;
    }
    int ok = 1;
    for(int i = 0 ; i < n ; i ++){
        b[a[i]] = 1;
        int cnt = 0;

        if(a[i] >= 0 && b[a[i] - 1] != -1){
            cnt = 1;
        }
        if(a[i] <= n - 1 && b[a[i] + 1] != -1){
            cnt = 1;
        }
        if(cnt == 0 && i != 0){
            ok = 0;
            break;
        }
//        cout << b[a[i] + 1] << " " << b[a[i] - 1]<<endl;
    }
//    for(int i = 1 ; i <= n ; i ++)
//    {
//        cout << b[i] << " ";
//    }
    if(ok){
        cout << "YES" <<endl;
    }else cout << "NO" <<endl;
}

int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    int T = 1;
    cin >> T;
    while (T--) solve();
//    cout << "\n"[];
    return 0;
}